#include "stdafx.h"
#include "PropertyTemplate.h"

#include "../db/PropertyTemplate.h"

#ifdef WIN32
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#endif

namespace serika
{
	namespace dq
	{
		PropertyTemplate::PropertyTemplate(db::PropertyTemplate* tmpl, TransientState::Enum state)
		{
			mTmpl = new Template(tmpl, state);
		}

		PropertyTemplate::~PropertyTemplate()
		{
			delete mTmpl;
		}

		// static 
		PropertyTemplate* PropertyTemplate::FromDb(db::PropertyTemplate* tmpl)
		{
			return new PropertyTemplate(tmpl, TransientState::Clean);
		}

		int PropertyTemplate::GetId() const
		{
			return mTmpl->GetInt("id");
		}

		const ut::String& PropertyTemplate::GetName() const
		{
			return mTmpl->GetString("name");
		}

		const ut::String& PropertyTemplate::GetDescription() const
		{
			return mTmpl->GetString("description");
		}
	}
}
